home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qbsnip.zip / REDIRCT.BAS < prev    next >
BASIC Source File  |  1997-06-20  |  870b  |  31 lines

  1. 'From: Joe Negron
  2. 'Date: 05-20-97  22:48
  3.  
  4. DEFINT A-Z
  5.  
  6. '$INCLUDE: 'qb.bi'
  7.  
  8. DECLARE FUNCTION Redirected% ()
  9.  
  10. '***********************************************************************
  11. '* FUNCTION Redirected%
  12. '*
  13. '* PURPOSE
  14. '*    Uses DOS ISR 21H, Function 44H (IOCTL - Get Device Information) to
  15. '*    determine if the program's output is being redirected.
  16. '***********************************************************************
  17. FUNCTION Redirected% STATIC
  18.      DIM IRegs AS RegType, ORegs AS RegType
  19.  
  20.      IRegs.ax = &H4400                         'IOOOCTL - Get Device Info
  21.      IRegs.bx = 1                              'for STDOUT
  22.  
  23.      Interrupt &H21, IRegs, ORegs              'Call DOS
  24.  
  25.      Redirected% = -1                          'Assume redirection
  26.      IF ORegs.dx AND &H80 THEN                 'Then check
  27.             Redirected% = 0
  28.      END IF
  29. END FUNCTION
  30.  
  31.